package o;

public final class anq {
    private long ˊ;
    private volatile long ˎ = -9223372036854775807L;
    private long ˏ;

    public anq(long j) {
        ॱ(j);
    }

    public synchronized void ॱ(long j) {
        amm.ˏ(this.ˎ == -9223372036854775807L);
        this.ˏ = j;
    }

    public long ˏ() {
        return this.ˏ;
    }

    public long ˊ() {
        if (this.ˎ != -9223372036854775807L) {
            return this.ˎ + this.ˊ;
        }
        return this.ˏ != Long.MAX_VALUE ? this.ˏ : -9223372036854775807L;
    }

    public long ˎ() {
        if (this.ˏ == Long.MAX_VALUE) {
            return 0;
        }
        return this.ˎ != -9223372036854775807L ? this.ˊ : -9223372036854775807L;
    }

    public void ॱ() {
        this.ˎ = -9223372036854775807L;
    }

    public long ˏ(long j) {
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        long j2;
        if (this.ˎ != -9223372036854775807L) {
            long ˎ = ˎ(this.ˎ);
            long j3 = (4294967296L + ˎ) / 8589934592L;
            j2 = ((j3 - 1) * 8589934592L) + j;
            j3 = (j3 * 8589934592L) + j;
            if (Math.abs(j2 - ˎ) >= Math.abs(j3 - ˎ)) {
                j2 = j3;
            }
        } else {
            j2 = j;
        }
        return ˊ(ˋ(j2));
    }

    public long ˊ(long j) {
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        if (this.ˎ != -9223372036854775807L) {
            this.ˎ = j;
        } else {
            if (this.ˏ != Long.MAX_VALUE) {
                this.ˊ = this.ˏ - j;
            }
            synchronized (this) {
                this.ˎ = j;
                notifyAll();
            }
        }
        return this.ˊ + j;
    }

    public static long ˋ(long j) {
        return (1000000 * j) / 90000;
    }

    public static long ˎ(long j) {
        return (90000 * j) / 1000000;
    }
}
